package com.example.boot.dluseraddress.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.example.boot.dluseraddress.service.DlUserAddressService;
import com.example.boot.util.ResultData;
import com.example.boot.util.ResultUtil;

@RestController
public class DlUserAddressController {

	private final static Logger logger = LoggerFactory.getLogger(DlUserAddressController.class);

	@Autowired
	private DlUserAddressService dlUserAddressService;

	@RequestMapping(value ="save/address",method=RequestMethod.GET)
	public ResultData<Object> saveAddress(String addressDetail) throws Exception {
		logger.info("添加收获地址|addressDetail={}", addressDetail);
		return ResultUtil.success(dlUserAddressService.saveAddress(addressDetail));
	}
	
	@RequestMapping(value ="find/address",method=RequestMethod.GET)
	public ResultData<Object> byOpenIdFinAllAddress(String openId) throws Exception {
		logger.info("查找用户收获地址|openId={}", openId);
		return ResultUtil.success(dlUserAddressService.byOpenIdFinAllAddress(openId));
	}

}
